import axios from '@/libs/api.request';
import { axiosHttp } from '@/libs/request'

/**
 * 登录
 * @param {*} param0
 */
export const login = (params) => {
  return axiosHttp('/admin/index/login', params);
}

export const getCode = (params) => {
  return axiosHttp('/index/getCode', params);
}


export const uploadImgBase64 = (params) => {
  return axiosHttp('/index/uploadImgBase64', params);
}

/**
 * 获取登录人信息
 * @param {*} token
 */
export const getUserInfo = (token) => {
  return axiosHttp('/admin/admin_user/getUserInfo', {});

}


/**
 * 退出登录
 * @param {*} token
 */
export const logout = (token) => {
  return axiosHttp('/admin/User/loginOut', {});
}

export const getUnreadCount = () => {
  // return axios.request({
  //   url: 'message/count',
  //   method: 'get'
  // })
}

export const getMessage = () => {
  return axios.request({
    url: 'message/init',
    method: 'get'
  })
}

export const getContentByMsgId = msg_id => {
  return axios.request({
    url: 'message/content',
    method: 'get',
    params: {
      msg_id
    }
  })
}

export const hasRead = msg_id => {
  return axios.request({
    url: 'message/has_read',
    method: 'post',
    data: {
      msg_id
    }
  })
}

export const removeReaded = msg_id => {
  return axios.request({
    url: 'message/remove_readed',
    method: 'post',
    data: {
      msg_id
    }
  })
}

export const restoreTrash = msg_id => {
  return axios.request({
    url: 'message/restore',
    method: 'post',
    data: {
      msg_id
    }
  })
}
//获取运营商列表
export const operatorList = (params) => {
  return axiosHttp('/delivery/getOperatorList', params);
}

//获取补货设备列表
export const ReplenishmentDeviceList = (params) => {
  return axiosHttp('/delivery/getReplenishmentDeviceList', params);
}
//设备详情
export const CupboardInfo = (params) => {
  return axiosHttp('/delivery/getCupboardInfo', params);
}
//获取司机列表
export const DeliveryUserList = (params) => {
  return axiosHttp('/delivery/getDeliveryUserList', params);
}
//生成配送订单
export const createDeliveryOrder = (params) => {
  return axiosHttp('/delivery/createDeliveryOrder', params);
}
//配货设备列表
export const PrepareGoodsDeviceList = (params) => {
  return axiosHttp('/delivery/getPrepareGoodsDeviceList', params);
}


//配送任务列表(不筛选司机)
export const getGroupOrderList = (params) => {
  return axiosHttp('/delivery/getGroupOrderList', params);
}
//配送任务列表(筛选司机)
export const getDriverOrderList = (params) => {
  return axiosHttp('/delivery/getDriverOrderList', params);
}
//配送任务列表-配送单
export const getOrderList = (params) => {
  return axiosHttp('/delivery/getOrderList', params);
}
//结束订单
export const closeOrder = (params) => {
  return axiosHttp('/delivery/closeOrder', params);
}
//商品出入库记录
export const getGoodsOrderRecord = (params) => {
  return axiosHttp('/delivery/getGoodsOrderRecord', params);
}
//待安装派单商家列表
export const InstallFranchiserList = (params) => {
  return axiosHttp('/franchiser/getInstallFranchiserList', params);
}
// 创建安装订单
export const createInstallOrder = (params) => {
  return axiosHttp('/franchiser/createInstallOrder', params);
}